import type { ListDataI, ListParams } from '@/types'
import type {
  FreeRuleListDataI,
  CarCardParams,
  CardDetail,
  CardListData,
  CardListParams,
  RuleHandleParamsI,
  CardViewDetailI,
  AreaI,
  PaymentI,
} from '@/types/card.d.ts'
import { http } from '@/utils/reuqest'

/**
 * 获取月卡列表数据
 */
export const cardGetCardListDataApi = (params: CardListParams) => {
  return http.get<CardListData>('parking/card/list', params)
}
/**
 * 新增月卡
 */
export const cardAddCardApi = (data: CarCardParams) => {
  return http.post<null>('parking/card', data)
}
/**
 * 获取月卡详情
 */
export const cardGetCardDetailApi = (id: string) => {
  return http.get<CardDetail>(`parking/card/detail/${id}`)
}
/**
 * 编辑月卡
 */
export const cardUpdateCardApi = (data: CardDetail) => {
  return http.put<null>('parking/card/edit', data)
}
/**
 * 删除月卡
 */
export const cardDeleteCardApi = (ids: string) => {
  return http.delete<null>(`parking/card/${ids}`)
}
/**
 * 月卡续费
 */
export const cardRechargeApi = (data: any) => {
  return http.post<null>('parking/card/recharge', data)
}
/**
 * 查看月卡详情
 */
export const cardViewDetailApi = (Id: string) => {
  return http.get<CardViewDetailI>(`parking/card/${Id}`)
}
/**
 * 获取计费规则列表
 */
export const ruleGetFreeRuleListApi = (params: any) => {
  return http.get<FreeRuleListDataI>('parking/rule/list', params)
}
/**
 * 删除计费规则
 */
export const ruleDelFreeRuleApi = (id: number) => {
  return http.delete<null>(`parking/rule/${id}`)
}
/**
 * 添加计费规则
 */
export const ruleAddFreeRuleApi = (data: RuleHandleParamsI) => {
  return http.post<null>('parking/rule', data)
}
/**
 * 查看计费规则详情
 */
export const ruleGetFreeRuleDetailApi = (id: number) => {
  return http.get<RuleHandleParamsI>(`parking/rule/${id}`)
}
/**
 * 编辑计费规则
 */
export const ruleEditFreeRuleApi = (data: RuleHandleParamsI) => {
  return http.put<null>('parking/rule', data)
}
/**
 * 查看区域列表
 */
export const areaGetListApi = (params: ListParams) => {
  return http.get<ListDataI<AreaI>>('parking/area/list', params)
}
/**
 * 添加区域
 */
export const areaAddApi = (data: AreaI) => {
  return http.post<null>('parking/area', data)
}
/**
 * 编辑区域
 */
export const areaEditApi = (data: AreaI) => {
  return http.put<null>('parking/area', data)
}
/**
 * 删除区域
 */
export const areaDelApi = (id: number) => {
  return http.delete<null>(`parking/area/${id}`)
}
/**
 * 查看停车缴费列表
 */
export const peymentGetListApi = (params: ListParams) => {
  return http.get<ListDataI<PaymentI>>('parking/payment/list', params)
}
